package com.rhb.af.console;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Runner implements Runnable {

	private boolean flag = true ;
	private BufferedReader br;
	List<String> result = new ArrayList();

	public Runner(InputStream inStream){
		br = new BufferedReader(new InputStreamReader(inStream));
	}
	
	public Runner(){
	}
	
	@Override
	public void run() {
		StringBuffer sb = new StringBuffer();
		try {
			String s;
			while(flag && (s = br.readLine()) != null) {
				append(s);
			}
		}
		catch(IOException e) {
			e.printStackTrace();
		}
	}
	
	
	public synchronized void shutDown() {
        flag = false ;
    }
	
    public synchronized boolean isShutDown() {
        return flag;
    }
    
	private void append(String str){
		result.add(str);
	}
	
	public List<String> getResult(){
		return result;
	}


}
